<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../../common/tagInclude.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
	<base href="${basePath}" />
	<title>新闻列表</title>
	<META http-equiv="content-type" content="text/html; charset=UTF-8">
	<LINK href="${basePath}styleAdmin/css/portalinabox.css" type="text/css" rel="stylesheet">		
	<meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
   <meta http-equiv="expires" content="0">
	<script type="text/javascript" src="${basePath}styleAdmin/js/prototype-1.6.0.3.js"></script>
	<script type="text/javascript" src="${basePath}styleAdmin/js/Calendar/WdatePicker.js"></script>
	<script type="text/javascript" src="${basePath}styleAdmin/js/common.js"></script>
	<script type="text/javascript">
		function doQuery(){
			document.myform.action = "${basePath}admin/contentInfo/list.do";
			document.myform.submit();
		}
		function edit(contentId){
			window.location = "${basePath}admin/contentInfo/showUpdate.do?contentId=" + contentId ;
		}
		function del(contentId){
			if(!confirm('确定要删除此新闻?'))return ;
			window.location = "${basePath}admin/contentInfo/del.do?contentId=" + contentId ;
		}
		function delSel(itemName){
			var all_checkbox = document.getElementsByName(itemName);
			var len = all_checkbox.length;
			if(isChecked(itemName) == false ){
				alert('至少选择一项');
			}else{
				if(!confirm('确认要删除指定文章?'))return;
				var values = "";
				for(var i=0;i<len ;i++){
					if(all_checkbox[i].checked)
						values += "," + all_checkbox[i].value;
				}
				if(values.length > 1)
					values = values.substring(1);
				window.location = '${basePath}admin/contentInfo/del.do?contentId='+values;
			}
		}
		function synch(contentId){
			window.location = '${basePath}admin/contentInfo/showContentSynch.do?contentId='+contentId;
		}
		function contentSynch(itemName){
			var all_checkbox = document.getElementsByName(itemName);
			var len = all_checkbox.length;
			if(isChecked(itemName) == false ){
				alert('至少选择一项');
			}else{
				if(!confirm('确认要同步指定文章?'))return;
				var values = "";
				for(var i=0;i<len ;i++){
					if(all_checkbox[i].checked)
						values += "," + all_checkbox[i].value;
				}
				if(values.length > 1)
					values = values.substring(1);
				window.location = '${basePath}admin/contentInfo/showContentSynch.do?contentId=' + values;
			}
		}
		function editForUse(websiteId,contentId){
			if(!confirm('确认要编辑此新闻并且进行使用?'))return;
			window.location = '${basePath}synch/contentInfo/contentReadSend.do?websiteId=' + websiteId + '&contentId=' + contentId;
		}
</script>
</HEAD>
<body bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">
<form action="" method="get" name="myform">
<%@include file="../common/navigate.jsp" %>
<table width="96%" border="0" align="center" cellpadding="0" style="margin-top:5px;" cellspacing="0">
	<tr>
		<td valign="top">
			<!-- 搜索栏 -->
			<table width="100%" border="1" class="mainFunctionTable"  cellpadding="0" cellspacing="1">
				<tr height="25" class="pLabel">
			   		<td class="td_nwarpstyle">&nbsp;&nbsp;新闻信息列表</td>
			 	</tr>
			 	<tr>
			   		<td width="100%" height="25">
			   			<table width="100%" border="0" cellspacing="1">
			     			<tr>
			       				<td align="left">
			       				关键字&nbsp;<input type="text" name="kw" id="kw" value="${content.kw}"/>&nbsp;&nbsp;
								发布人&nbsp;<select name="userId" id="userId">
										<option value="">请选择</option>
										<c:forEach var="userInfo" items="${userInfoList}">
											<option value="${userInfo.id}" <c:if test="${content.userId == userInfo.id}">selected</c:if> >${userInfo.realName}</option>
										</c:forEach>				
									</select>&nbsp;&nbsp;
								来源&nbsp;<select name="websiteId" id="websiteId">
										<option value="">请选择</option>
										<c:forEach var="website" items="${websiteInfoList}">
											<option value="${website.id}" <c:if test="${content.websiteId == website.id}">selected</c:if> >${website.name}</option>
										</c:forEach>				
									</select>
								</td>
								<td align="right">
									<a href="javascript:doQuery();"><img src="${basePath}styleAdmin/images/button/query.gif" border="0"/></a>
			       					&nbsp;&nbsp;&nbsp;&nbsp;<a href="${basePath}admin/contentInfo/showInsert.do" id="lnkAdd"><img src="${basePath}styleAdmin/images/button/addNew.gif" border="0"></a>
			       				</td>
			     			</tr>
			    		</table>
			    	</td>
			   </tr>
			 </table>
		  </td>
	  </tr>
	  <tr>
	    <td>
	    	<a href="javascript:checkAll('contentId',true);">全选</a>&nbsp;&nbsp;<a href="javascript:checkAll('contentId',false);">取消</a>&nbsp;&nbsp;
			<a href="javascript:contentSynch('contentId');">同步所选</a>&nbsp;&nbsp;
			<a href="javascript:delSel('contentId');">删除所选</a>&nbsp;&nbsp;<br/>
			<table width=100% border=1 class="mainFunctionTable"  cellpadding="0" cellspacing="1" id="table_channel">
				<tr height=25 class="pLabel" align="center">
					<td width="5%" class="td_nwarpstyle">标识</td>
					<td class="td_nwarpstyle">标题</td>
					<td width="10%" class="td_nwarpstyle">来源</td>
					<td width="10%" class="td_nwarpstyle">发布人</td>
					<td width="15%" class="td_nwarpstyle">发布时间</td>
					<td width="8%" class="td_nwarpstyle">编辑采用</td>
					<td width="10%" class="td_nwarpstyle">操作</td>
				</tr>
			</table>
			<table width=100% border=1 class="mainFunctionTable"  cellpadding="0" cellspacing="1" id="table_channel">
					<c:forEach items="${contentInfoList}" var="content" varStatus="status">
	   					<c:choose>
	   						<c:when test="${status.index % 2 == 0 }"><c:set var="css" value="c1" /></c:when>
	   						<c:otherwise><c:set var="css" value="c2" /></c:otherwise>
	   					</c:choose>
						<tr class="${css}">
							<td width="5%" height="25px" align="center"><input type="checkbox" id="contentId" name="contentId" value="${content.contentId}"/></td>
							<td>${content.title}</td>
							<td width="10%" align="center">${content.websiteInfo.name}</td>
							<td width="10%" align="center">
								<c:if test="${content.websiteInfo.isSelf==1}">${content.userInfo.realName}</c:if>
							</td>
							<td width="15%" align="center">${content.publishTime}</td>
							<td width="8%" align="center"><a href="javascript:editForUse('${content.websiteId}','${content.contentId}');">编辑采用</a></td>
							<td width="10%" align="center">
								<a href="javascript:edit('${content.contentId}');"><img src="${basePath}styleAdmin/images/edit.gif" border="0" title="编辑"/></a>&nbsp;&nbsp;
								<a href="javascript:del('${content.contentId}');"><img src="${basePath}styleAdmin/images/delete.gif" border="0" title="删除"/></a>&nbsp;&nbsp;
								<a href="javascript:synch('${content.contentId}');"><img src="${basePath}styleAdmin/images/writer.gif" border="0" title="同步"/></a>
							</td>
						</tr>
					</c:forEach>
	  		</table>
		 </td>
	   </tr>
	   <tr>
		   <td height=25>
		   	<c:set var="pageURL" value="${basePath}admin/websiteInfo/list?"/>
			<%@include file="../common/page.jsp"%>
		  </td>
	  </tr>
</table>
</form>
</body>
</HTML>